<?php
namespace App\Enums\Api;
enum Response :int{
    case SERVICE_SUCCESS = 200;
    case TOKEN_ERROR=401;
    case SYSTEM_CHECK_ERROR = 403;
    case SYSTEM_DATA_NOT_EXISTS = 404;
    case SYSTEM_ERROR = 505;
    case SYSTEM_REQUEST_ERROR = 506;
    case SYSTEM_NOT_FIND= 507;
    //其他问题
    public function response(): string {
        return Response::getResponse($this);
    }
    public static function getResponse(self $value): string {
        return match ($value) {
            Response::SERVICE_SUCCESS => '成功',
            Response::TOKEN_ERROR =>'请重新登陆',
            Response::SYSTEM_CHECK_ERROR=>'验证失败',
            Response::SYSTEM_ERROR => '服务器错误',
            Response::SYSTEM_REQUEST_ERROR=>'请求方式错误',
            Response::SYSTEM_NOT_FIND=>'页面路径不存在',
            Response::SYSTEM_DATA_NOT_EXISTS=>'数据不存在',
        };
    }
}
